package com.cqeec.service.imp;

import java.sql.Connection;

import javax.swing.JOptionPane;

import com.cqeec.dao.ManagerDao;

import com.cqeec.dao.imp.ManagerDaoimp;

import com.cqeec.domain.Manager; 
import com.cqeec.service.ManagerService;

public class ManagerServicelmpl implements ManagerService {

	@Override
	public Manager findManagerByID(Connection conn, Manager manager) {
		
	   ManagerDao  dao = new ManagerDaoimp();
		 
		Manager user = dao.findManagerByID(conn,manager.getManagerNum());
 
		if(user==null) {
			JOptionPane.showMessageDialog(null, "没有此人", "提示", JOptionPane.ERROR_MESSAGE);
			return null;
		} 
		if(user.getManagerName().trim().equals(manager.getManagerPwd().trim())) {
			return user;
		} 
		
		
		
		return user;
	}

	@Override
	public void upateManagerByManagerName(Connection connection, Manager manager) throws Exception {
		// TODO Auto-generated method stub
		 ManagerDao dao = new ManagerDaoimp();
		 dao.upateManagerByManagerName(connection,manager);
	}


	
	
  

}
